function fakeClick(obj) {
  var ev = document.createEvent('MouseEvents')
  ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
  obj.dispatchEvent(ev)
}
/**
 * 导出数据
 * @param {*} name 文件名称
 * @param {*} data 文件内容
 */
export function exportRaw(name: string, data: any) {
  const urlObject = window.URL || window.webkitURL
  const export_blob = new Blob([data])
  const save_link = document.createElement('a')
  save_link.href = urlObject.createObjectURL(export_blob)
  save_link.download = name
  fakeClick(save_link)
}

// exportRaw('filename.txt', '要保存的字符串')
